#ifndef PLAYER_H
#define PLAYER_H

#include <QObject>
#include<QString>
#include"cards.h"

class Player : public QObject
{
    Q_OBJECT
public:
    enum Role{Lord,Farme};//角色
    enum Sex{Man,Woman};//
    enum Direction{Left,Right};//头像显示方位
    enum Type{Robot,User,UnKnow};//角色
    explicit Player(QObject *parent = nullptr);
    explicit Player(QString name,QObject *parent = nullptr);


    QString name() const;
    void setName(const QString &name);

    //

    Role role() const;
    void setRole(const Role &role);

    Sex sex() const;
    void setSex(const Sex &sex);

    //头像显示方位
    Direction direction() const;
    void setDirection(const Direction &direction);

    //玩家类型
    Type type() const;
    void setType(const Type &type);

    int score() const;
    void setScore(int score);

    bool iswin() const;
    void setIswin(bool iswin);

    //提供当前对象的上家/下家对象


    Player *prev() const;
    void setPrev(Player *prev);

    Player *next() const;
    void setNext(Player *next);


    //叫地主/抢地主
    void grabLordBt(int point);
    //储存扑克牌
    void storeDispatchCard(Card&card);
    void storeDispatchCard(Cards&cards);

    //得到所有的牌
    Cards getCards();
    //清空玩家所有牌
    void clearCards();
    //出牌
    void playHand(Cards&cards);

    //设置出牌玩家已经待处理的扑克牌
    void setPendingInfo(Player*player,Cards&cards);
    Player *getPendPlayer();
    Cards getPendCards();


    //虚函数
    virtual void prepareCallLord();
    virtual void preparePlayHand();



signals:

    //通知已经下注了
    void notifyGrabLordBet(Player*player,int bet);
public slots:
protected:
    QString m_name;
    Role m_role;
    Sex m_sex;
    Direction m_direction;
    Type m_type;
    //玩家的分数
    int m_score;
    //游戏结果
    bool m_iswin;
    Player*m_prev;
    Player*m_next;
    Cards m_cards;

    Cards m_pendCards;
    Player*m_pendPlayer;
};



#endif // PLAYER_H
